package org.watchrecords.dbo;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.validation.constraints.NotNull;

@Entity
@NamedQueries({
@NamedQuery(name = "getCellRecords", query = "SELECT cr FROM CellRecord cr ORDER BY cr.created DESC")
})
public class CellRecord implements Identifiable {
    /**
     * 
     */
    private static final long serialVersionUID = 453549461887965046L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    
    private boolean incoming = true;
    private String crimes;
    
    @NotNull(message = "You must enter the Watchman name")
    private String watchman;
    
    private Date created;
    
    @NotNull(message = "You must select the date and time")
    private Date recordTime;
    
    @Column(length = 2000)
    private String notes;
    @Column(length = 2000)
    private String possessions;
    
    @ManyToOne(cascade = CascadeType.PERSIST)
    @NotNull(message = "You must select the offender")
    private Offender offender;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public boolean isIncoming() {
        return incoming;
    }

    public void setIncoming(boolean incoming) {
        this.incoming = incoming;
    }

    public String getCrimes() {
        return crimes;
    }

    public void setCrimes(String crimes) {
        this.crimes = crimes;
    }

    public String getWatchman() {
        return watchman;
    }

    public void setWatchman(String watchman) {
        this.watchman = watchman;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getPossessions() {
        return possessions;
    }

    public void setPossessions(String possessions) {
        this.possessions = possessions;
    }

    public Offender getOffender() {
        return offender;
    }

    public void setOffender(Offender offender) {
        this.offender = offender;
    }

    public Date getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(Date recordTime) {
        this.recordTime = recordTime;
    }
}
